<HTML>
<HEAD>
<!-- This HTML file has been created by texi2html 1.54
     from nitfol.texi on 24 October 1999 -->

<TITLE>Nitfol</TITLE>

</HEAD>
<BODY>
<H1>Nitfol</H1>
<P>
<P><HR><P>
<H1>Table of Contents</H1>
<UL>
<LI><A NAME="TOC1" HREF="nitfol.html#SEC1">1  Introduction</A>
<LI><A NAME="TOC2" HREF="nitfol.html#SEC2">2  Invoking nitfol</A>
<LI><A NAME="TOC3" HREF="nitfol.html#SEC3">3  Features</A>
<UL>
<LI><A NAME="TOC4" HREF="nitfol.html#SEC4">3.1  Preferences</A>
<LI><A NAME="TOC5" HREF="nitfol.html#SEC5">3.2  Infinite undo/redo</A>
<LI><A NAME="TOC6" HREF="nitfol.html#SEC6">3.3  Aliases</A>
<LI><A NAME="TOC7" HREF="nitfol.html#SEC7">3.4  Abbreviation Expansion</A>
<LI><A NAME="TOC8" HREF="nitfol.html#SEC8">3.5  Typo correction</A>
<LI><A NAME="TOC9" HREF="nitfol.html#SEC9">3.6  Automapping</A>
<LI><A NAME="TOC10" HREF="nitfol.html#SEC10">3.7  Quetzal</A>
<LI><A NAME="TOC11" HREF="nitfol.html#SEC11">3.8  Blorb</A>
</UL>
<LI><A NAME="TOC12" HREF="nitfol.html#SEC12">4  Debugger</A>
<LI><A NAME="TOC13" HREF="nitfol.html#SEC13">5  Bugs</A>
<LI><A NAME="TOC14" HREF="nitfol.html#SEC14">6  Thanks</A>
<LI><A NAME="TOC15" HREF="nitfol.html#SEC15">7  Games Cited</A>
</UL>
<P><HR><P>


<H1><A NAME="SEC1" HREF="nitfol.html#TOC1">1  Introduction</A></H1>

<P>
Nitfol is a portable interpreter for Z-machine code, the game format used by Infocom and more recently, <A HREF="http://www.gnelson.demon.co.uk/inform.html"><TT>Inform</TT></A>.  Nitfol handles versions one through eight of the format, and attempts to comply with version 1.0 of the Z-machine specification.

</P>
<P>
You will need game files to use nitfol.  The "if-archive" contains a large collection of these, available at <A HREF="ftp://ftp.gmd.de/if-archive/games/zcode/"><TT>ftp://ftp.gmd.de/if-archive/games/zcode/</TT></A> or at the USA mirror <A HREF="http://ifarchive.org/indexes/if-archiveXgamesXzcode.html"><TT>http://ifarchive.org/indexes/if-archiveXgamesXzcode.html</TT></A>.

</P>
<P>
This manual describes how to use nitfol and how it differs from other Z-machine interpreters.  This manual was written with UNIX-like systems in mind; ignore that which does not apply to your platform.  Comments on and corrections for this manual and nitfol are appreciated and should be sent to <A HREF="mailto:nitfol@my-deja.com"><TT>nitfol@my-deja.com</TT></A>.

</P>



<H1><A NAME="SEC2" HREF="nitfol.html#TOC2">2  Invoking nitfol</A></H1>

<P>
Invoke nitfol with the game filename, and options.  If you omit the game filename, nitfol will prompt you for one.  The following options are recognized:

</P>
<DL COMPACT>

<DT><CODE>-ignore</CODE>
<DD>
<DT><CODE>-no-ignore</CODE>
<DD>
<DT><CODE>-i</CODE>
<DD>
Ignore Z-machine strictness errors.  Normally nitfol checks for illegal and undefined Z-machine behaviour and alerts the user.  If you're playing someone else's buggy game, this can be annoying and you should use this option.

<DT><CODE>-fullname</CODE>
<DD>
<DT><CODE>-no-fullname</CODE>
<DD>
<DT><CODE>-f</CODE>
<DD>
For running under Emacs or DDD.  Tells nitfol to give machine-recognizeable markers when stack frames are displayed instead of displaying the line. Only useful if you are using nitfol as an inferior debugger.

<DT><CODE>-command <VAR>file</VAR></CODE>
<DD>
<DT><CODE>-x <VAR>file</VAR></CODE>
<DD>
Read commands from this file.  Load a script from a file for playback in the game.

<DT><CODE>-pirate</CODE>
<DD>
<DT><CODE>-no-pirate</CODE>
<DD>
<DT><CODE>-P</CODE>
<DD>
Aye, matey.  Make the piracy opcode not branch, letting the game know the game disc is not "genuine." Infocom never used this opcode and neither should you, but if obscurity amuses you...

<DT><CODE>-quiet</CODE>
<DD>
<DT><CODE>-no-quiet</CODE>
<DD>
<DT><CODE>-q</CODE>
<DD>
Do not print introductory messages.  For GDB compatibility.

<DT><CODE>-spell</CODE>
<DD>
<DT><CODE>-no-spell</CODE>
<DD>
Perform spelling correction.  Normally Z-machine games are unforgiving of typos (though they do have an <CODE>oops</CODE> command). If you type in a word which isn't in the game's dictionary and have typo correction enabled, nitfol will search for a word which is off by one letter by a substitution, deletion, insertion or transposition.

<DT><CODE>-expand</CODE>
<DD>
<DT><CODE>-no-expand</CODE>
<DD>
Expand one letter abbreviations.  Early Z-machine games don't include <KBD>x</KBD> as a synonym for <KBD>examine</KBD> and such.  If the first word in a sentence is one letter long and not recognized by the game, this will attempt to expand it to a full word.

<DT><CODE>-symbols <VAR>file</VAR></CODE>
<DD>
<DT><CODE>-s <VAR>file</VAR></CODE>
<DD>
Specify symbol file for game.  If you want to perform source-level debugging, you will need to specify a symbol file, which contains the names of variables and tells nitfol how source code corresponds to object code.

<DT><CODE>-tandy</CODE>
<DD>
<DT><CODE>-no-tandy</CODE>
<DD>
<DT><CODE>-t</CODE>
<DD>
Censors some Infocom games.  Some version 3 games perform minor wording changes when this bit is set to appease the sensitivity of Tandy Corporation.

<DT><CODE>-transcript <VAR>wfile</VAR></CODE>
<DD>
<DT><CODE>-T <VAR>wfile</VAR></CODE>
<DD>
Write transcript to this file.  This transcript begins as soon as the game starts.

<DT><CODE>-debug</CODE>
<DD>
<DT><CODE>-no-debug</CODE>
<DD>
<DT><CODE>-d</CODE>
<DD>
Enter debugger immediatly.  Imitate GDB by not automatically starting the story.

<DT><CODE>-prompt <VAR>string</VAR></CODE>
<DD>
Specify debugging prompt.  This is the prompt nitfol prints when it is waiting for a debugging command (as opposed to the &#62; the game story prints when waiting for a game command).  DDD requires this to be <SAMP>`(gdb) '</SAMP>.

<DT><CODE>-path <VAR>string</VAR></CODE>
<DD>
Look for games in this directory.  If nitfol cannot find the requested game in the current directory, it looks through the directories listed in the given colon separated string.  The directories specified here are also used to search for gamefiles from saved games.   If this option is not used, nitfol looks at the <CODE>INFOCOM_PATH</CODE> environment variable.

<DT><CODE>-autoundo</CODE>
<DD>
<DT><CODE>-no-autoundo</CODE>
<DD>
Ensure <CODE>@save_undo</CODE> is called every turn.  If a turn passes with no <CODE>@save_undo</CODE> between, this option performs the <CODE>@save_undo</CODE> automagically.  Could cause problems with some games which have a different concept of a turn.

<DT><CODE>-stacklimit <VAR>number</VAR></CODE>
<DD>
<DT><CODE>-S <VAR>number</VAR></CODE>
<DD>
Exit when the stack is this deep.  If a game is infinitely recursing, nitfol will allocate large amounts of memory and take a long time before the problem is reported.  This option makes it fatal to recurse more than the given number of stack frames.  Setting this to 0 makes nitfol allow as many as fit contiguously in memory.  The Z-machine Standards Document recommends games use no more than 1024 words of total stack (frames and pushed data) in ZIP, which roughly works out to 90 routine calls deep.

<DT><CODE>-alias <VAR>string</VAR></CODE>
<DD>
<DT><CODE>-a <VAR>string</VAR></CODE>
<DD>
Specify an alias.  Adds an alias which will be expanded in read lines before tokenisation.  The alias is of the form <VAR>name</VAR> <VAR>value</VAR>; you will need to use quotes around it on the commandline.

<DT><CODE>-ralias <VAR>string</VAR></CODE>
<DD>
Specify an recursive alias.  Adds an alias whose result is checked for further alias expansion.  Identical syntax to adding a normal alias.

<DT><CODE>-unalias <VAR>string</VAR></CODE>
<DD>
Remove an alias.  Removes an alias previously added by -alias.  Useful for removing aliases in preference files.

<DT><CODE>-random <VAR>number</VAR></CODE>
<DD>
<DT><CODE>-r <VAR>number</VAR></CODE>
<DD>
Set random seed.  Normally the random number generator is initialized with the time of day.  If this option is used with a non-zero argument, the given number will be used to initialize the generator and for <CODE>@random 0</CODE>.

<DT><CODE>-mapsym <VAR>string</VAR></CODE>
<DD>
Specify mapping glyphs.  Nitfol draws maps using ASCII characters; you can choose which characters it uses to draw rooms.  Defaults to <SAMP>`*udb@UDB+'</SAMP>, which is, in order: empty room, room with down exit, room with up exit, room with up and down exits, room with player, room with player and up exit, room with player and down exit, room with player and up and down exits, bend symbol.

<DT><CODE>-mapsize <VAR>number</VAR></CODE>
<DD>
Specify map size.  Determines the number of lines to be used for the map.

<DT><CODE>-maploc <VAR>string</VAR></CODE>
<DD>
Specify map location.  Nitfol creates a Glk window for the map it generates.  The map can be placed <SAMP>`above'</SAMP>, <SAMP>`below'</SAMP>, to the <SAMP>`right'</SAMP>, or the <SAMP>`left'</SAMP>, of the main game window.  Follow this option with one those locations.

<DT><CODE>-terpnum <VAR>number</VAR></CODE>
<DD>
Specify interpreter number.  Each port of Infocom's Z-machine interpreter was given a number.  <SAMP>`1'</SAMP> for their own DECSystem-20, <SAMP>`2'</SAMP> for Apple IIe, <SAMP>`3'</SAMP> for Macintosh, <SAMP>`4'</SAMP> for Amiga, <SAMP>`5'</SAMP> for Atari ST, <SAMP>`6'</SAMP> for IBM PC, <SAMP>`7'</SAMP> for Commodore 128, <SAMP>`8'</SAMP> for Commodore 64, <SAMP>`9'</SAMP> for Apple IIc, <SAMP>`10'</SAMP> for Apple IIgs, <SAMP>`11'</SAMP> for Tandy Color.  Giving this option makes nitfol claim to be running on the specified system.  A few games change their behaviour slightly depending on which machine type they run.  By default nitfol claims to be on an Apple IIe, as this makes Beyond Zork not do character graphics.

<DT><CODE>-terpver <VAR>string</VAR></CODE>
<DD>
Specify interpreter version.  Infocom's interpreters were given versions, typically a capital letter.  Nitfol defaults to <SAMP>`N'</SAMP>, Frotz uses <SAMP>`F'</SAMP>, and ZIP uses <SAMP>`B'</SAMP>.  Any single character version is allowed.  Multicharacter options are read as a number instead of an ASCII character.  Only known effect upon games is the letter printed by banners and the <SAMP>`version'</SAMP> command.  Version 6 games interpret this as a number instead of a letter.

</DL>



<H1><A NAME="SEC3" HREF="nitfol.html#TOC3">3  Features</A></H1>



<H2><A NAME="SEC4" HREF="nitfol.html#TOC4">3.1  Preferences</A></H2>

<P>
If you don't like the default options and don't want to recompile, you can set your preferences by writing a <TT>`.nitfolrc'</TT> in your home directory.

</P>
<P>
Each line should be of the form <CODE><VAR>option</VAR>=<VAR>value</VAR></CODE>.  Blank lines and lines starting with a <CODE>#</CODE> are ignored.  If you want to specify different options for different copies of nitfol, you can put those options in a block which will only be read by copies of nitfol with a specific name.

</P>
<P>
Here's an example <TT>`.nitfolrc'</TT>:

<PRE>
path=/usr/local/games/infocom
alias=v verbose
alias=asierra tone cordial. ask sierra about
ignore=true

[strictnitfol]
ignore=false
spell=false
expand=false
autoundo=false
unalias=v
unalias=asierra

[xnitfol]
tandy=true
pirate=true
</PRE>

<P>
Nitfol will look in <TT>`/usr/local/games/infocom'</TT> for game files.  Copies of nitfol named <TT>`strictnitfol'</TT> will report Z-machine strictness errors, perform strict tokenisation, and not automatically <CODE>@save_undo</CODE>.  All others will ignore strictness errors and have two aliases.  <TT>`xnitfol'</TT> will set the Tandy bit and branch on the piracy opcode.

</P>
<P>
Options specified in the preference file may be overruled by environment variables and command line options.

</P>



<H2><A NAME="SEC5" HREF="nitfol.html#TOC5">3.2  Infinite undo/redo</A></H2>

<P>
Multiple <CODE>@restore_undo</CODE> opcodes with no intervening <CODE>@save_undo</CODE> will restore earlier and earlier saved states.  However, Inform games will not do this, so if you want infinite undo, you must enter the commands <CODE>/undo</CODE> and <CODE>/redo</CODE>. The <CODE>/...</CODE> commands are part of the debugger, so you will need to compile in debugger support to use this feature.

</P>
<P>
Z-machine games prior to version 5 do not provide undo (none of them provide redo), and some version 5 games don't use it (like <CITE>Wishbringer</CITE>).  If the game performs two <CODE>@read</CODE> opcodes with no intervening <CODE>@save_undo</CODE> or <CODE>@restore_undo</CODE>, nitfol will perform a <CODE>@save_undo</CODE>.

</P>



<H2><A NAME="SEC6" HREF="nitfol.html#TOC6">3.3  Aliases</A></H2>

<P>
If the game has long words which you wish to abbreviate, you can use aliases.  Use the command <CODE>/alias <VAR>name</VAR> <VAR>value</VAR></CODE>.  All instances of <VAR>name</VAR> in line input will be replaced with <VAR>value</VAR>.  <VAR>name</VAR> may not contain whitespace.

</P>
<P>
Unlike abbreviation expansion and typo correction, alias expansion modifies the text buffer, inserting the requested text.  This is necessary to allow multiple commands to be given in an alias through the use of periods.

</P>
<P>
Aliases are not expanded recursively, so you could do something clever like this:

<PRE>
&#62;<KBD>/alias e w</KBD>
<KBD>/alias w e</KBD>
<KBD>/alias nw ne</KBD>
<KBD>/alias ne nw</KBD>
<KBD>/alias sw se</KBD>
<KBD>/alias se sw</KBD>
</PRE>

<P>
And your east-west movement will be swapped (<KBD>e</KBD> will do a <KBD>w</KBD>, though <KBD>east</KBD> will still do <KBD>east</KBD>).  Aliases expand on all input the game receives using <CODE>@read</CODE>, including transcripts and directions from the automapper.

</P>
<P>
If you want the expansion of the alias to be checked for further aliases, you must use the <CODE>/ralias</CODE> command.  This expansion is stopped when an alias would expand itself.

<PRE>
&#62;<KBD>/ralias e w</KBD>
<KBD>/ralias w e</KBD>
</PRE>

<P>
Would do nothing, as <KBD>e</KBD> is expanded to <KBD>w</KBD>, which is expanded to <KBD>e</KBD>, and then it stops because the rule for expanding <KBD>e</KBD> has already taken place.

</P>

<PRE>
&#62;<KBD>/ralias hanoi2 move src to extra. move src to dest. move extra to dest</KBD>
<KBD>/alias src left</KBD>
<KBD>/alias dest center</KBD>
<KBD>/alias extra right</KBD>
<KBD>hanoi2</KBD>
You move the small disc from the left peg to the right peg.
You move the medium disc from the left peg to the middle peg.
You move the small disc from the right peg to the middle peg.
&#62;move left to right
You move the large disc from the left peg to the right peg.
&#62;<KBD>/alias src center</KBD>
<KBD>/alias dest right</KBD>
<KBD>/alias extra left</KBD>
<KBD>hanoi2</KBD>
You move the small disc from the middle peg to the left peg.
You move the medium disc from the middle peg to the right peg.
You move the small disc from the left peg to the right peg.
</PRE>

<P>
Ideally you should be able to define an alias which recursively solves any depth by relying on lower levels being solvable, but this isn't yet possible.  You must keep the expansion of aliases to a reasonable size, since Inform has a fairly small buffer size.

</P>
<P>
You can remove aliases using the <CODE>/unalias</CODE> command.

<PRE>
&#62;<KBD>/unalias hanoi2</KBD>
</PRE>

<P>
Aliases do not effect <CODE>/...</CODE> commands; if they did, it wouldn't be possible to <CODE>/unalias</CODE>.

</P>



<H2><A NAME="SEC7" HREF="nitfol.html#TOC7">3.4  Abbreviation Expansion</A></H2>

<P>
Early Infocom games don't provide abbreviations like <KBD>x</KBD> for <KBD>examine</KBD>.  If you enable abbreviation expansion, nitfol will attempt to expand one letter words at the beginning of inputs which are not in the game's dictionary.

</P>
<P>
Nitfol supports the following expansions (note that some are non-standard):

</P>
<TABLE>

<TR>c <TD> close
 <TD> d <TD> down
 <TD> e <TD> east
 <TD> g <TD> again
<BR>
<TR>i <TD> inventory
 <TD> k <TD> attack
 <TD> l <TD> look
 <TD> n <TD> north
<BR>
<TR>o <TD> oops
 <TD> p <TD> open
 <TD> q <TD> quit
 <TD> r <TD> drop
<BR>
<TR>s <TD> south
 <TD> t <TD> take
 <TD> u <TD> up
 <TD> w <TD> west
<BR>
<TR>x <TD> examine
 <TD> y <TD> yes
 <TD> z <TD> wait
</TABLE>

From <CITE>Zork I</CITE>:

<PRE>
<STRONG>West of House</STRONG>
You are standing in an open field west of a white house, with a
boarded front door.
There is a small mailbox here.

&#62;<KBD>x mailbox</KBD>
[x -&#62; examine]
The small mailbox is closed.

&#62;<KBD>p it</KBD>
[p -&#62; open]
Opening the small mailbox reveals a leaflet.

&#62;<KBD>t leaflet</KBD>
[t -&#62; take]
Taken.
</PRE>



<H2><A NAME="SEC8" HREF="nitfol.html#TOC8">3.5  Typo correction</A></H2>

<P>
In the Z-machine, the <CODE>@read</CODE> opcode provides the interpreter with a dictionary to search in order to do tokenisation and word matching.  If you enable typo correction and enter a word not in the provided dictionary, nitfol will search for near misses.

</P>
<P>
From <CITE>Curses</CITE>:

<PRE>
&#62;<KBD>ask jemmia about gloves</KBD>
[jemmia -&#62; jemima]
"Those are my gloves."
</PRE>

<P>
Nitfol takes the following steps to correct typos:

</P>

<OL>
<LI>

If the entered word is in the dictionary, behave as normal.

<LI>

If the length of the word is less than 3 letters long, give up.  We don't want to make assumptions about what so short words might be.

<LI>

If the word is the same as a dictionary word with one transposition, assume it is that word.  <KBD>exmaine</KBD> becomes <KBD>examine</KBD>.

<LI>

If it is a dictionary word with one deleted letter, assume it is that word.  <KBD>botle</KBD> becomes <KBD>bottle</KBD>.

<LI>

If it is a dictionary word with one inserted letter, assume it is that word.  <KBD>tastey</KBD> becomes <KBD>tasty</KBD>.

<LI>

If it is a dictionary word with one substitution, assume it is that word.  <KBD>opin</KBD> becomes <KBD>open</KBD>.
</OL>

<P>
This behavior can be annoying when nitfol "corrects" intentionally entered words which are similar to dictionary words.  Usually this has no effect upon the game, perhaps slightly changing the game's error message, but may have negative effects when it causes an undesired action.  Games like <CITE>Beyond Zork</CITE> expect you to type words not in their dictionary to name things.  Nitfol might "correct" your entered word to a dictionary word, which the game might complain about.

</P>
<P>
If typo correction is getting in your way, run nitfol with <SAMP>`-no-smart'</SAMP>, compile it without applying <SAMP>`-DSMART_TOKENISER'</SAMP>, or edit <TT>`nitfol.opt'</TT> to change the compile-time default.

</P>



<H2><A NAME="SEC9" HREF="nitfol.html#TOC9">3.6  Automapping</A></H2>

<P>
Nitfol has the ability to display an on-screen map showing visited rooms and their connections on the current floor.  Below is a map generated from <CITE>Enchanter</CITE>.

<PRE>
                                   *-* *
                                   |   |
                   u-*-*-*-*-------*---*
                   |               |
       * *   *     |     *---*     |
       |/ \ /      |    /|\ / \    |
       *   *       *   / | X * \   *
      /     \      |  /  |/ v|  \  |
     /   *   *-*-*-*-*---*---u---*-*-*-@
    /    |  /      | |\  |\ ^|  /  |    
 *-*     * *       | | \ | X * /   *-*
    \    |/        | |  \|/ \ /    |  
     *   *         * *   *---*     *
      \ /          | |             |
       *           u-d-*-----------*-u
                                   |  
                                   *
                                    \
                                     *
</PRE>

<P>
The <SAMP>`*'</SAMP>s designate rooms; the <SAMP>`@'</SAMP> the current room.  Rooms containing staircases are shown with a <SAMP>`u'</SAMP> or <SAMP>`d'</SAMP>, or <SAMP>`b'</SAMP> if the staircase is bi-directional.  If the current room contains a staircase, nitfol draws it with a <SAMP>`U'</SAMP>, <SAMP>`D'</SAMP>, or <SAMP>`B'</SAMP>.  Passageways are shown with lines; the <SAMP>`X'</SAMP>s are crossed lines.  One-way passages are shown as lines with arrows.  Nitfol uses <SAMP>`v'</SAMP>, <SAMP>`^'</SAMP>, <SAMP>`&#60;'</SAMP>, and <SAMP>`&#62;'</SAMP> for arrow heads.

</P>
<P>
In Glks which provide mouse events, you can click on rooms and it will display the room name (and number) in the upper left hand corner of the map.  Note that XGlk is slightly broken, so you need to click on the left-hand side of the room.  Clicking on an empty map space clears the name.

</P>
<P>
In order to use automapping, you must tell nitfol how to calculate the current location.  You do this by specifying an Inform expression, so you must have debugging enabled.

</P>
<P>
Typically the current location is available in a global.  In Z-code versions 3 and prior, the current location is always stored in global zero, so typing <KBD>/automap (global) 0</KBD> should work.  In later versions, you must figure out an expression which evaluates to the current location.

</P>
<P>
First, find out where the player object is.  Typically, the player object is named <SAMP>`self'</SAMP>, <SAMP>`cretin'</SAMP>, <SAMP>`self-object'</SAMP>, or the name of the PC.  You can use the <CODE>find</CODE> command to search object names.  If this all fails, try <CODE>object-tree</CODE> to find the location number.

</P>
<P>
Once you have found the number of the location, you need to figure out which global keeps track of the location.  You can use the <CODE>globals</CODE> command to search the globals.

</P>
<P>
From <CITE>Spider And Web</CITE>:

<PRE>
&#62;<KBD>/find self</KBD>
20 "(self object)"
25 "yourself" in 91 "End of Alley"
26 "yourself" in 48 "chair"
<KBD>/globals 91</KBD>
G15 G36 G39
<KBD>s</KBD>

<STRONG>Mouth of Alley</STRONG>
You're in the entrance of a narrow brick alley, which runs further
in to the north. To the south a broad street courses by, congested
with traffic and bicycles, although none of them seem to notice you.

&#62;<KBD>/find self</KBD>
20 "(self object)"
25 "yourself" in 94 "Mouth of Alley"
26 "yourself" in 48 "chair"
<KBD>/globals 94</KBD>
G15 G36 G39
<KBD>/automap (global) 15</KBD>
</PRE>

<P>
Obviously we have 3 globals tracking the player location.  Typically there are only two, but some games have more.  In this, we just picked the first one, which is probably the Inform <CODE>location</CODE> variable; another is probably the <CODE>real_location</CODE> variable.  Depending on how you want automapping to behave in the dark, or when dealing with game-specific stuff, you may want to pick a different one.

</P>
<P>
To figure out what is in which direction, nitfol checks the current location, tells the game to go north, checks the new location, undoes the north movement, tries to go northeast, and so on.  During all of this, output is disabled.

</P>
<P>
Drawing the map is more complicated.  First nitfol looks for cycles in the graph and makes the cycles connect properly.  Then it draws the map.  If parts of the map overlapp, it finds a path connecting the overlapping bits and tries increasing the length of each passage in this path by one, and recalculates cycle connections.  If this solves the problem, it's done; otherwise, it tries increasing the length of two passages, or of one of the passages by two.  If this fails, it gives up.

</P>
<P>
This technique isn't perfect.  The implementation of this technique isn't perfect either.  So expect nitfol to misbehave a lot on complex maps, and a little on simple maps.  If you clever ideas on how to improve it, let me know.

</P>
<P>
Nitfol makes an effort to simplify the map.  If multiple exits go from the barn to cornfield and you've been to both places, nitfol will draw a single two-way passage if possible.  If both up and west go up the stairs and nitfol knows east returns from the top of the stairs, nitfol will draw it as a simple west-east passage ignoring the up/down.  If east doesn't return from the top of the staircase, nitfol will draw it as up/down, leaving out the west passage.

</P>
<P>
If you've been north of a gate, and come up to the gate from the south,
and unlock the gate, nitfol will draw it as a one-way passage since last
time it was north of the gate, it couldn't go south.

</P>
<P>
Some games feature reincarnation, perhaps moving you to a new location.  If movement leads to your death, this makes nitfol think the reincarnation location is in that direction.  Nitfol watches for three asterisks in a row and will assume they mean death instead of a normal passage.

</P>
<P>
Some of these problems could be avoided by having nitfol explore each neighboring room, but this would make automapping even slower.

</P>



<H2><A NAME="SEC10" HREF="nitfol.html#TOC10">3.7  Quetzal</A></H2>

<P>
Nitfol uses Quetzal version 1.4 for its save format, so you can use your saves between different computers and interpreters.  More information about Quetzal is available at <A HREF="http://www.geocities.com/SiliconValley/Vista/6631/"><TT>http://www.geocities.com/SiliconValley/Vista/6631/</TT></A>.

</P>
<P>
If you specify a save-file on the command-line on UNIX, nitfol uses a <CODE>UNIX</CODE> <CODE>IntD</CODE> chunk to locate the game file associated with the save name.  This chunk is included in save games when nitfol can figure out the current filename.  If you compile nitfol with -D__USE_GNU, -D__USE_BSD, or -D__USE_XOPEN_EXTENDED, nitfol will canonicalize the file name, so you don't have to worry about relative file name specifications no longer working if you invoke nitfol from a different directory.

</P>
<P>
On MacOS, nitfol uses alias records from a <CODE>MACS</CODE> <CODE>IntD</CODE> chunk to locate the game file.  This won't work for games built-in to the interpreter.

</P>
<P>
If no <CODE>IntD</CODE> chunk is included, nitfol searches the environment variable <CODE>INFOCOM_PATH</CODE> for a game with matching release number, serial number, and checksum.

</P>
<P>
Looking for games without an <CODE>IntD</CODE> chunk isn't foolproof, but it should work most of the time.  Serial numbers are basically the date and it's extremely unlikely more than ten games will be compiled on the same day (the only time lots of games are compiled on same day is right before competition time).  Assuming they all have the same release number, there's still only a .0686% chance that at least two of these ten will share the same checksum.  If someone reports this as a problem, I'll make nitfol ensure the game contains a <CODE>save</CODE> opcode right before the restored PC.

</P>



<H2><A NAME="SEC11" HREF="nitfol.html#TOC11">3.8  Blorb</A></H2>

<P>
If you wish to hear sounds or see graphics in your games, they must be packaged in Blorb files.  The Z-machine game may included in the Blorb file or may be specified separately.  Nitfol does not support the traditional Infocom <TT>`.mg1'</TT> and <TT>`.snd'</TT> files.

</P>
<P>
Note that graphics are displayed incorrectly, and sound has not yet been tested.

</P>


<H1><A NAME="SEC12" HREF="nitfol.html#TOC12">4  Debugger</A></H1>

<P>
Nitfol debugging mode tries to imitate the GDB interface.  If you're familiar with that, you should have no problem using nitfol (other than dealing with the current incompleteness).

</P>
<P>
You need inform 6.21 or later, as earlier versions don't produce correct infix files without a patch.  You then need to compile infix information for your game.  I recommend doing:

</P>
<P>
<CODE>inform -k -~S -~X -~D <VAR>MyGame</VAR>.inf</CODE>

</P>
<P>
Then your debug information will be in <TT>`gameinfo.dbg'</TT>.  If you have a command-line on your platform, run nitfol like <CODE>nitfol <VAR>MyGame</VAR>.z5 -symbols gameinfo.dbg</CODE>.  Otherwise, start up your game and type <CODE>/symbol-file gameinfo.dbg</CODE> the first time you get a prompt.

</P>
<P>
When the game stops to read a line of text, you can begin that line with <KBD>/</KBD> to give a debug command.  If you want to pass a line beginning with a <KBD>/</KBD> to the game, double the <KBD>/</KBD> and the game will be passed the second one.  When at a <CODE>(nitfol) </CODE> prompt, starting commands with <KBD>/</KBD> is neither necessary nor recommended.

</P>
<P>
All expressions are like the ones used in Inform.

</P>
<P>
You can perform casts to get the result in the form you want:

</P>
<DL COMPACT>

<DT><CODE>(number) <VAR>expression</VAR></CODE>
<DD>
Use <VAR>expression</VAR> as if it were a number.  Useful when you want to know the number of something, not the object, routine, or string information nitfol normally gives.
<DT><CODE>(object) <VAR>expression</VAR></CODE>
<DD>
Use <VAR>expression</VAR> as if it were an object.  Most useful when printing the result, as it will show the object's attributes and properties.
<DT><CODE>(routine) <VAR>expression</VAR></CODE>
<DD>
Use <VAR>expression</VAR> as if it were the packed address of a routine.  Useful if you have the packed address of a routine which you want to set a breakpoint at.
<DT><CODE>(string) <VAR>expression</VAR></CODE>
<DD>
Use <VAR>expression</VAR> as if it were the packed address of a string.  Useful for printing it.
<DT><CODE>(global) <VAR>expression</VAR></CODE>
<DD>
Evaluates to the value of a numbered global.  <CODE>(global) 0</CODE> is the player location for version 3 Infocom games.
<DT><CODE>(local) <VAR>expression</VAR></CODE>
<DD>
Evaluates to the value of a numbered local.  Not terribly useful unless you're debugging something without source.
</DL>

<P>
Here are short descriptions of the debugger commands.  See Info file `gdb', node `Top', for more information.  Some of these were taken/adapted from GDB's help.

</P>
<DL COMPACT>

<DT><CODE>info breakpoints</CODE>
<DD>
<A NAME="IDX1"></A>
<DT><CODE>info breakpoints <VAR>num</VAR></CODE>
<DD>
<A NAME="IDX2"></A>
List breakpoints.  An argument specifies a specific breakpoint to list.

<DT><CODE>quit</CODE>
<DD>
<A NAME="IDX3"></A>
Exit nitfol.

<DT><CODE>show language</CODE>
<DD>
<A NAME="IDX4"></A>
Show the current source language.

<DT><CODE>condition <VAR>num</VAR> <VAR>exp</VAR></CODE>
<DD>
<A NAME="IDX5"></A>
Set a condition for an existing breakpoint.

<DT><CODE>restore</CODE>
<DD>
<A NAME="IDX6"></A>
Restore a saved game.

<DT><CODE>break <VAR>linespec</VAR></CODE>
<DD>
<A NAME="IDX7"></A>
<DT><CODE>break <VAR>linespec</VAR> if <VAR>exp</VAR></CODE>
<DD>
<A NAME="IDX8"></A>
Set a breakpoint.  An <CODE>if</CODE> clause specifies a condition.

<DT><CODE>stepi</CODE>
<DD>
<A NAME="IDX9"></A>
<DT><CODE>stepi <VAR>num</VAR></CODE>
<DD>
<A NAME="IDX10"></A>
Step exactly one instruction.  An argument specifies a repeat count.

<DT><CODE>restart</CODE>
<DD>
<A NAME="IDX11"></A>
Restart the game.

<DT><CODE>object-tree</CODE>
<DD>
<A NAME="IDX12"></A>
<DT><CODE>object-tree <VAR>exp</VAR></CODE>
<DD>
<A NAME="IDX13"></A>
Display the object tree.  An argument says which object to use as the root of the tree.

<DT><CODE>disable display <VAR>num</VAR></CODE>
<DD>
<A NAME="IDX14"></A>
Temporarily disable an automatic display.

<DT><CODE>select-frame <VAR>num</VAR></CODE>
<DD>
<A NAME="IDX15"></A>
Select a specific stack frame.

<DT><CODE>alias <VAR>name</VAR> <VAR>value</VAR></CODE>
<DD>
<A NAME="IDX16"></A>
Add an alias

<DT><CODE>down-silently</CODE>
<DD>
<A NAME="IDX17"></A>
<DT><CODE>down-silently <VAR>num</VAR></CODE>
<DD>
<A NAME="IDX18"></A>
Silently select the child of the selected frame.  An argument specifies how many frames down to go.

<DT><CODE>frame</CODE>
<DD>
<A NAME="IDX19"></A>
<DT><CODE>frame <VAR>num</VAR></CODE>
<DD>
<A NAME="IDX20"></A>
Show the selected stack frame.  An argument specifies a stack frame to show.

<DT><CODE>give <VAR>exp</VAR> <VAR>num</VAR></CODE>
<DD>
<A NAME="IDX21"></A>
<DT><CODE>give <VAR>exp</VAR> ~ <VAR>num</VAR></CODE>
<DD>
<A NAME="IDX22"></A>
Give an object an attribute.  With a tilde clears the attribute instead of setting it.

<DT><CODE>set <VAR>exp</VAR></CODE>
<DD>
<A NAME="IDX23"></A>
Evaluate an expression without printing its value.

<DT><CODE>print <VAR>exp</VAR></CODE>
<DD>
<A NAME="IDX24"></A>
Evaluates an expression and prints the result.  This can include function calls.

<DT><CODE>up</CODE>
<DD>
<A NAME="IDX25"></A>
<DT><CODE>up <VAR>num</VAR></CODE>
<DD>
<A NAME="IDX26"></A>
Select the parent of the selected frame.  An argument specifies how many frames up to go.

<DT><CODE>#  comment</CODE>
<DD>
<A NAME="IDX27"></A>
Enter a comment

<DT><CODE>continue</CODE>
<DD>
<A NAME="IDX28"></A>
<DT><CODE>continue <VAR>num</VAR></CODE>
<DD>
<A NAME="IDX29"></A>
Continue execution.  An argument sets the ignore count of the current breakpoint.

<DT><CODE>dumpmem <VAR>file</VAR></CODE>
<DD>
<A NAME="IDX30"></A>
Dump memory to a file

<DT><CODE>undo</CODE>
<DD>
<A NAME="IDX31"></A>
Undo last move (not last debugger command).

<DT><CODE>display <VAR>exp</VAR></CODE>
<DD>
<A NAME="IDX32"></A>
Print value of an expression each time the program stops.

<DT><CODE>move <VAR>exp</VAR> to <VAR>exp</VAR></CODE>
<DD>
<A NAME="IDX33"></A>
Move an object around the object tree.

<DT><CODE>up-silently</CODE>
<DD>
<A NAME="IDX34"></A>
<DT><CODE>up-silently <VAR>num</VAR></CODE>
<DD>
<A NAME="IDX35"></A>
Select the parent of the selected frame silently.  An argument specifies how many frames up to go.

<DT><CODE>show copying</CODE>
<DD>
<A NAME="IDX36"></A>
Show licensing information.

<DT><CODE>recording off</CODE>
<DD>
<A NAME="IDX37"></A>
Stop recording a script.

<DT><CODE>jump <VAR>linespec</VAR></CODE>
<DD>
<A NAME="IDX38"></A>
Continue execution at a new location.

<DT><CODE>recording on</CODE>
<DD>
<A NAME="IDX39"></A>
Start recording a script.

<DT><CODE>ralias <VAR>name</VAR> <VAR>value</VAR></CODE>
<DD>
<A NAME="IDX40"></A>
Add a recursive alias

<DT><CODE>globals</CODE>
<DD>
<A NAME="IDX41"></A>
<DT><CODE>globals <VAR>exp</VAR></CODE>
<DD>
<A NAME="IDX42"></A>
List all global variables and their values.  With an argument, list all only those with a specific value.

<DT><CODE>backtrace</CODE>
<DD>
<A NAME="IDX43"></A>
<DT><CODE>backtrace <VAR>num</VAR></CODE>
<DD>
<A NAME="IDX44"></A>
<DT><CODE>backtrace - <VAR>num</VAR></CODE>
<DD>
<A NAME="IDX45"></A>
Display the parent functions of the current frame.  An argument specifies how many frames back to show.  If the argument is negative, start from the first frame instead of the current.

<DT><CODE>find</CODE>
<DD>
<A NAME="IDX46"></A>
Find objects whose shortnames contain a string.

<DT><CODE>finish</CODE>
<DD>
<A NAME="IDX47"></A>
An argument specifies a repeat count.

<DT><CODE>down</CODE>
<DD>
<A NAME="IDX48"></A>
<DT><CODE>down <VAR>num</VAR></CODE>
<DD>
<A NAME="IDX49"></A>
Select the child of the selected frame.  An argument specifies how many frames down to go.

<DT><CODE>ignore <VAR>num</VAR> <VAR>num</VAR></CODE>
<DD>
<A NAME="IDX50"></A>
Set the ignore count for a breakpoint.

<DT><CODE>replay off</CODE>
<DD>
<A NAME="IDX51"></A>
Halt replay.

<DT><CODE>nexti</CODE>
<DD>
<A NAME="IDX52"></A>
<DT><CODE>nexti <VAR>num</VAR></CODE>
<DD>
<A NAME="IDX53"></A>
Step one instruction, stepping over subroutine calls.  Step a specified number of instructions, stepping over subroutine calls.

<DT><CODE>help</CODE>
<DD>
<A NAME="IDX54"></A>
Print list of commands.

<DT><CODE>redo</CODE>
<DD>
<A NAME="IDX55"></A>
Redo undid move.  Only works immediately after an <CODE>undo</CODE>.

<DT><CODE>enable <VAR>num</VAR></CODE>
<DD>
<A NAME="IDX56"></A>
Re-enabled a breakpoint.

<DT><CODE>until</CODE>
<DD>
<A NAME="IDX57"></A>
Resume execution until the program reaches a line number greater than the current line.

<DT><CODE>replay</CODE>
<DD>
<A NAME="IDX58"></A>
Replay a recorded script.

<DT><CODE>unalias <VAR>name</VAR></CODE>
<DD>
<A NAME="IDX59"></A>
Remove an alias

<DT><CODE>remove <VAR>exp</VAR></CODE>
<DD>
<A NAME="IDX60"></A>
Remove an object from the object tree.

<DT><CODE>info sources</CODE>
<DD>
<A NAME="IDX61"></A>
List source files.

<DT><CODE>delete <VAR>num</VAR></CODE>
<DD>
<A NAME="IDX62"></A>
Delete a breakpoint.

<DT><CODE>symbol-file <VAR>file</VAR></CODE>
<DD>
<A NAME="IDX63"></A>
Load debugging info from a file (usually <TT>`gameinfo.dbg'</TT>).

<DT><CODE>automap <VAR>exp</VAR></CODE>
<DD>
<A NAME="IDX64"></A>
Start automapping

<DT><CODE>show warranty</CODE>
<DD>
<A NAME="IDX65"></A>
Show warranty information.

<DT><CODE>disable <VAR>num</VAR></CODE>
<DD>
<A NAME="IDX66"></A>
Temporarily disable a breakpoint.

<DT><CODE>undisplay <VAR>num</VAR></CODE>
<DD>
<A NAME="IDX67"></A>
Stop automatically displaying an expression.

<DT><CODE>enable display <VAR>num</VAR></CODE>
<DD>
<A NAME="IDX68"></A>
Re-enable an automatic display.

<DT><CODE>step</CODE>
<DD>
<A NAME="IDX69"></A>
<DT><CODE>step <VAR>num</VAR></CODE>
<DD>
<A NAME="IDX70"></A>
Step through program to a different source line.  An argument specifies a repeat count.

<DT><CODE>info source</CODE>
<DD>
<A NAME="IDX71"></A>
Get information on the current source file.

<DT><CODE>next</CODE>
<DD>
<A NAME="IDX72"></A>
<DT><CODE>next <VAR>num</VAR></CODE>
<DD>
<A NAME="IDX73"></A>
Step through program, stepping over subroutine calls.  An argument specifies a repeat count.

</DL>

<P>
If you're on a UNIX and you don't like the GDB interface, you can compile cheapnitfol and run it as the inferior debugger under Emacs or DDD.  You can also try compiling <CODE>xnitfol</CODE> with <SAMP>`-DSTDOUT_DEBUG'</SAMP> and trying that, but I haven't tested that much.

</P>
<P>
<CODE>ddd <VAR>MyGame</VAR>.z5 --debugger cheapnitfol -s gameinfo.dbg -prompt "(gdb) "</CODE>

</P>


<H1><A NAME="SEC13" HREF="nitfol.html#TOC13">5  Bugs</A></H1>

<P>
A nitfol bug is any behaviour which makes nitfol reliably misbehave, with the exceptions of bugs in Glk libraries.  These include: anything which makes nitfol crash (other than when nitfol reports <SAMP>`FATAL'</SAMP> errors), anything which causes nitfol to contradict the Z-machine standards documents (except for optional enhancements like spelling correction and debug mode), any buffer overflows, and anything which makes nitfol infinite loop other than infinite loops in the game itself.

</P>
<P>
Before reporting a bug, make sure the bug is not listed below and your copy of nitfol is not compiled with <SAMP>`-DFAST'</SAMP>.  Please report the version of nitfol, your system type and a series of commands which reliably cause the bug.

</P>
<P>
Nitfol is lacking:

<UL>
<LI>Graphical font (<CITE>Beyond Zork</CITE>)  (should use images for this)

<LI>Terminating character support (mostly <CITE>Beyond Zork</CITE>)

<LI>Reverse video, full color (should querry Glk more aggressively)

<LI>Unicode support

<LI>keypad character codes

<LI>its own random number generator (relies on system one)

</UL>

<P>
Nitfol does incorrectly:

<UL>
<LI>Play is not paused to wait for sounds to complete in <CITE>The Lurking Horror</CITE>.

<LI>Pictures and text are not placed correctly for v6 games.

<LI>block quotes are placed in the upper window, so <CODE>cheapnitfol</CODE> can't see them.

<LI>Corrupted save files may make nitfol do bad things.

<LI>Should figure out a way to handle buggy games like <CITE>AMFV</CITE> and <CITE>Varicella</CITE> which assume the upper window is 80 columns wide.

<LI>Doesn't catch header writing other than <CODE>@storeb</CODE> and <CODE>@storew</CODE>.

</UL>

<P>
Debugger problems:

<UL>
<LI>Sometimes says there's no code at a location where it could be clever and

  find some.
<LI><CODE>ofclass</CODE>, superclass not implemented.

<LI>Should perform more sanity checks everywhere.

<LI>Lots of useful commands not yet implemented.

<LI><VAR>object</VAR>.<VAR>function</VAR> is handled incorrectly, both for assignments and calls.

<LI>Assumes you know what you're doing, so <CODE>quit</CODE>, <CODE>run</CODE>, etc., don't prompt you for confirmation.

</UL>

<P>
Automapping problems:

<UL>
<LI>Doesn't work well for random destinations (the forest in <CITE>Advent</CITE>)

<LI><CODE>@get_cursor</CODE> doesn't return the correct value during automapping since output is disabled.

<LI>Requires too much work for the end-user; should put in stuff to make it figure out the location global in 95% of games.

<LI>Doesn't really work if multiple locations are coded as being in the same room (long road in <CITE>Enchanter</CITE>).

<LI>Doesn't show exits which go nowhere, but change the game.

<LI>Perhaps should use graphics windows when available.

<LI>Movement causing teleportation confuses it.

<LI>Reincarnation handling isn't optimal.

<LI>Still very buggy.

<LI>It's too slow.

<LI>Should realize it can add extra bends (especially in one-way passages).

<LI>Should be able to output nice-looking Postscript.

<LI>Should store map in saved games (wait until automapping code stabilizes).

</UL>



<H1><A NAME="SEC14" HREF="nitfol.html#TOC14">6  Thanks</A></H1>

<P>
The following people have given comments, suggestions, bug reports, answered questions, or helped port nitfol (in alphabetical order):

<UL>
<LI>John Cater

<LI>Paul David Doherty

<LI>Martin Frost

<LI>Doug Jones

<LI>David Picton

<LI>Andrew Plotkin

<LI>Andrew Pontious

<LI>L. Ross Raszewski

<LI>Dan Shiovitz

</UL>



<H1><A NAME="SEC15" HREF="nitfol.html#TOC15">7  Games Cited</A></H1>

<P>
<CITE>Wishbringer</CITE> Copyright &#169; 1985, 1988 Infocom Inc.

</P>
<P>
<BR>
<CITE>Zork I</CITE> Copyright &#169; 1981-1986 Infocom Inc.

</P>
<P>
<BR>
<CITE>Curses</CITE> Copyright &#169; 1993-1994 Graham Nelson.

</P>
<P>
<A HREF="http://ifarchive.org/if-archive/games/zcode/curses.z5"><TT>http://ifarchive.org/if-archive/games/zcode/curses.z5</TT></A>

</P>
<P>
<BR>
<CITE>Beyond Zork</CITE> Copyright &#169; 1987 Infocom Inc.

</P>
<P>
<BR>
<CITE>Enchanter</CITE> Copyright &#169; 1983, 1984, 1986 Infocom Inc.

</P>
<P>
<BR>
<CITE>Varicella</CITE> by Adam Cadre 1999.

</P>
<P>
<A HREF="http://adamcadre.ac/content/vgame.z8"><TT>http://adamcadre.ac/content/vgame.z8</TT></A>

</P>
<P>
<BR>
<CITE>Spider And Web</CITE> Copyright &#169; 1997-1998 Andrew Plotkin.

</P>
<P>
<A HREF="http://ifarchive.org/if-archive/games/zcode/Tangle.z5"><TT>http://ifarchive.org/if-archive/games/zcode/Tangle.z5</TT></A>

</P>
<P><HR><P>
This document was generated on 24 October 1999 using the
<A HREF="http://wwwcn.cern.ch/dci/texi2html/">texi2html</A>
translator version 1.54.</P>
</BODY>
</HTML>
